package cn.iocoder.yudao.module.wms.dal.mysql.distribution;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wms.dal.dataobject.distribution.DistributionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wms.controller.admin.distribution.vo.*;

/**
 * 配送 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface DistributionMapper extends BaseMapperX<DistributionDO> {

    default PageResult<DistributionDO> selectPage(DistributionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DistributionDO>()
                .eqIfPresent(DistributionDO::getAddress, reqVO.getAddress())
                .eqIfPresent(DistributionDO::getCare, reqVO.getCare())
                .eqIfPresent(DistributionDO::getDid, reqVO.getDid())
                .eqIfPresent(DistributionDO::getDriver, reqVO.getDriver())
                .eqIfPresent(DistributionDO::getNumber, reqVO.getNumber())
                .eqIfPresent(DistributionDO::getPhone, reqVO.getPhone())
                .eqIfPresent(DistributionDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DistributionDO::getTime, reqVO.getTime())
                .eqIfPresent(DistributionDO::getUrgent, reqVO.getUrgent())
                .eqIfPresent(DistributionDO::getVid, reqVO.getVid())
                .orderByDesc(DistributionDO::getUpdateAt));
    }

}